var url = require('url')
const admin = require('./models/admin')
const role = require('./models/role')

let authFilter = ((req, res, result) => {
	if (result.username !== 'admin') {
		let pathname = url.parse(req.url, true).pathname
		let arr = ['update', 'delete']
		let index = arr.findIndex(item => {
			return pathname.indexOf(item) > -1
		})
		if (index > -1) {
			return false
		} else {
			return true
		}
	} else {
		return true
	}
})
module.exports = authFilter
